import { defHttp } from '/@/utils/http/axios';
import setting from '/@/settings/projectSetting';

const Api = {
  emailCreate: `${setting.interfacePrefix}/email/create`, // 新增邮箱
  emailFetchMail: `${setting.interfacePrefix}/email/fetchMail`, // 从邮件服务器获取邮件
  emailListInbox: `${setting.interfacePrefix}/email/listInBox`, // 列出收件箱邮件
  emailGetDefaultEmailId: `${setting.interfacePrefix}/email/getDefaultEmailId`, // 取得默认邮箱的ID
  emailListOutBox: `${setting.interfacePrefix}/email/listOutBox`, // 发件箱邮件列表
  emailListDraft: `${setting.interfacePrefix}/email/listDraft`, // 邮件草稿箱列表
  emailListCycle: `${setting.interfacePrefix}/email/listCycle`, // 邮件垃圾箱列表
  emailSetReaded: `${setting.interfacePrefix}/email/setReaded`, // 置为未读/已读
  emailDelMail: `${setting.interfacePrefix}/email/delMail`, // 删除到垃圾箱
  emailMoveMail: `${setting.interfacePrefix}/email/moveMail`, // 移动邮件
  emailDelEmail: `${setting.interfacePrefix}/email/delEmail`, // 删除邮箱
  emailEditEmail: `${setting.interfacePrefix}/email/editEmail`, // 编辑邮箱配置信息
  emailUpdateEmail: `${setting.interfacePrefix}/email/updateEmail`, // 保存邮箱配置信息
  emailListEmail: `${setting.interfacePrefix}/email/listEmail`, // 邮箱列表
  emailShowMail: `${setting.interfacePrefix}/email/showMail`, // 邮件明细
  emailReply: `${setting.interfacePrefix}/email/reply`, // 回复邮件
  emailUpdateDraft: `${setting.interfacePrefix}/email/updateDraft`, // 保存草稿
  emailSend: `${setting.interfacePrefix}/email/send`, // 发送邮件
  emailListRecentlyEmail: `${setting.interfacePrefix}/email/listRecentlyEmail`, // 常用邮箱列表
  emailDelRecentlyEmail: `${setting.interfacePrefix}/email/delRecentlyEmail`, // 常用邮箱列表删除
  emailSendReceipt: `${setting.interfacePrefix}/email/sendReceipt`, // 回执
};

export const getEmailSendReceipt = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailSendReceipt,
    params,
  });
export const getEmailDelRecentlyEmail = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailDelRecentlyEmail,
    params,
  });
export const getEmailListRecentlyEmail = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailListRecentlyEmail,
    params,
  });
export const getEmailSend = (params?: any, url = '') =>
  defHttp.post<any>({
    url: Api.emailSend + url,
    params,
    headers: {
      'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundaryVD0qp8RY7NId5ucK',
    },
  });
export const getEmailUpdateDraft = (params?: any, url = '') =>
  defHttp.post<any>({
    url: Api.emailUpdateDraft + url,
    params,
    headers: {
      'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundaryVD0qp8RY7NId5ucK',
    },
  });
export const getEmailReply = (params?: any, url = '') =>
  defHttp.post<any>({
    url: Api.emailReply + url,
    params,
    headers: {
      'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundaryVD0qp8RY7NId5ucK',
    },
  });
export const getEmailShowMail = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailShowMail,
    params,
  });
export const getEmailListEmail = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailListEmail,
    params,
  });
export const getEmailUpdateEmail = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailUpdateEmail,
    params,
  });
export const getEmailEditEmail = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailEditEmail,
    params,
  });
export const getEmailDelEmail = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailDelEmail,
    params,
  });
export const getEmailMoveMail = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailMoveMail,
    params,
  });
export const getEmailDelMail = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailDelMail,
    params,
  });
export const getEmailSetReaded = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailSetReaded,
    params,
  });
export const getEmailListCycle = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailListCycle,
    params,
  });
export const getEmailListDraft = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailListDraft,
    params,
  });
export const getEmailListOutBox = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailListOutBox,
    params,
  });
export const getEmailGetDefaultEmailId = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailGetDefaultEmailId,
    params,
  });
export const getEmailListInbox = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailListInbox,
    params,
  });
export const getEmailFetchMail = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailFetchMail,
    params,
  });

export const getEmailCreate = (params?: any) =>
  defHttp.post<any>({
    url: Api.emailCreate,
    params,
  });
